package com.igeek.javase.ch06.jdbc.dao;

import com.igeek.javase.ch06.jdbc.entity.Admin;
import com.igeek.javase.ch06.jdbc.utils.JDBCUtilsByC3P0;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/*
 *@author wangpeng
 *2023/7/20 17:33
 *@description TODO
 */
public class AdminDao extends BaseDao<Admin>{
    //根据名字查询admin信息
    public String selectByName(String name) throws SQLException {
        String sql = "select username from admin where name = ?";
        String usname = (String)this.selectSingleValue(JDBCUtilsByC3P0.getConn(),sql,Admin.class,name);
        return usname;
    }
    //根据密码查询admin信息
    public String selectByPassword(String pwd) throws SQLException {
        String sql = "select password from admin where password = ?";
        String passwd = (String)this.selectSingleValue(JDBCUtilsByC3P0.getConn(),sql,Admin.class,pwd);
        return passwd;
    }



}
